package cn.zcq100.Observer.pull;
import java.util.ArrayList;

public class thisWeather  implements Observerble{
	private float Temperature;
	private float Humidity;
	private float Pressure;
	private boolean changed=false;
	private ArrayList<Observer> observers;


	public thisWeather(){
		observers=new ArrayList<Observer>();
	}
	
	public void setMesurement(float temperature,float Humidity,float Pressure){
		this.Temperature=temperature;
		this.Humidity=Humidity;
		this.Pressure=Pressure;
		setChange();
		NoticeObserver();
	}
	
	
	public void NoticeObserver() {
		if(changed==true){
			for(Observer ob:observers){
				ob.update(this);
			}
			this.changed=false;
		}
	}


	public void addObserver(Observer o) {
		observers.add(o);
	}

	public void removeObserver(Observer o) {
		observers.remove(o);
		
	}

	public void setChange() {
		this.changed=true;
		
	}

	public float getTemperature() {
		return Temperature;
	}

	public float getHumidity() {
		return Humidity;
	}

	public float getPressure() {
		return Pressure;
	}

}
